//
//  RootLoginViewController.h
//  BVCMS Search
//
//  Created by Allen Thomas on 9/13/10.
//
#import <UIKit/UIKit.h>

#define kNumberOfEditableRows 3
#define kUsernameRowIndex 0
#define kPasswordRowIndex 1
#define kServerRowIndex 2

#define kMin -75


@interface RootLoginViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate> {
	
	IBOutlet UIButton *loginButton;
	IBOutlet UITableView *table;
	
	NSUserDefaults *prefs;
	UITextField *textFieldBeingEdited;
	
	UITextField *usernameField;
	UITextField *passwordField;
	UITextField *serverField;
	
	NSMutableArray *organizations;
}

@property (nonatomic, retain) UIButton *loginButton;
@property (nonatomic, retain) UITableView *table;
@property (nonatomic, retain) NSMutableArray *organizations;

-(IBAction)login:(id)sender;
-(void) login_callback:(NSData *)data;
-(void) login_error_callback:(NSError *)error;

-(void) handleElement_Organizations: (NSDictionary*) attributes;
-(void) handleElement_Organization: (NSDictionary*) attributes;
-(void) parseXml:(NSData *)data;

-(void) loadUserDefaults;
-(void) saveUserDefaults;

-(IBAction)backgroundTap:(id)sender;
-(IBAction)textFieldDone:(id)sender;

-(NSString*)getText:(UITextField*)textField;

@end
